<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>角色管理页面</title>
<script type="text/javascript" src="<c:url value='/admin/js/util/jquery-1.8.1.min.js' />" ></script>
<script type="text/javascript" src="<c:url value='/admin/js/util/validate.js' />" ></script>
<link href="<c:url value='/admin/css/general.css' />" rel="stylesheet" type="text/css" />
<script language="javascript">
function addCustomers(o,a,b){ 
	var t=document.getElementById(o).getElementsByTagName("tr"); 
	for(var i=0;i<t.length;i++){ 
		t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b; 
		t[i].onmouseout=function(){ 
			if(this.x!="1")this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b; 
		};
	}
}
	
function returnMain() {
	document.location.href = "<c:url value='/admin/roleAction!list.do' />";
}

function submitForm() {
	if(validate()){
		$("#mainForm").attr("action", "<c:url value='/admin/roleAction!createExc.do' />");
		$("#mainForm").submit();
	}	
}

function validate() {
	if (!validateLength("roleName",1,50,"请输入角色名","请输入短一点的角色名"))
		return false;
	if (!validateLength("roleRemark",0,49,"","请输入短一点的角色说明"))
		return false;
	return true;
}
</script>
</head>
<body>
	<form id="mainForm" action="" method="post">
		<div class="tableTitle">添加角色</div>
		<table width="100%" cellspacing="1" id="addCustomers">
			<tr>
				<th colspan="2">注：带<b>*</b>号的为必填项
				</th>
			</tr>
			<tr>
				<td><span>角色名<b>*</b>：</span><input name="role.name" id="roleName" type="text" maxlength="50"/></td>
			</tr>
			<tr>
				<td><span>角色说明：</span><textarea name="role.remark" id="roleRemark"></textarea></td>
			</tr>
			<tr>
				<td><a href="javascript:submitForm();">保存</a> <a href="javascript:document.getElementById('mainForm').reset();">重置</a> <a
					href="javascript:returnMain();">返回</a></td>
			</tr>
		</table>
	</form>
	<script language="javascript">
	//addCustomers("表格名称","奇数行背景","偶数行背景","鼠标经过背景","点击后背景"); 
	addCustomers("addCustomers","#fff","#F6F6F6");
	</script>
</body>
</html>